import { rcaNumberFormat,get_month_first,get_date } from './common.js'
import { commonTableOption } from './common.js'
export const startDate = get_month_first(0);
export const endDate = get_date(0);
export const tableOption = {
  ...commonTableOption,
  menu: true,
  delBtn: false,
  editBtn: false,
  column: [
    {
      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '导入时间',
      prop: 'importTime',
      searchSpan: 12,
      //searchRange: true,
      //search: true,
      valueFormat: 'yyyy-MM-dd',
    }, {
      type: 'date',
      label: '报表开始日期',
      prop: 'beginTime',
      searchValue: startDate,
      searchLabelWidth: 120,
      //searchSpan: 12,
      //searchRange: true,
      search: true,
      valueFormat: 'yyyy-MM-dd',
    }, {
      type: 'date',
      label: '报表结束日期',
      prop: 'endTime',
      searchValue: endDate, 
      searchLabelWidth: 120,
      //searchSpan: 12,
      //searchRange: true,
      search: true,
      valueFormat: 'yyyy-MM-dd',
    }, {
      type: 'input',
      label: '导入人名称',
      prop: 'improtCreatorName'
    }, {
      type: 'input',
      label: '导入人工号',
      prop: 'importCreatorCode'
    }, {
      type: 'select',
      label: '对账确认表名称',
      prop: 'verfiyConfirmFlag',
      search: true,
      searchLabelWidth: 120,
      props:{
        label:'description',
        value:'value'
      },
      dicUrl: '/admin/dict/type/sw_ck_statement_confirm_table'
    }]
}

const commonConfig = {
  ...commonTableOption,
  page: false,
  refreshBtn: false,
  columnBtn: false,
  showSummary: true,
}

export const tableOption1 = {
  ...commonConfig,
  column: [
    {
      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
    }, {
      type: 'input',
      showSummary: true,
      label: '笔数',
      prop: 'count'
    }, {

      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '金额',
      prop: 'money'
    }, {

      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '手续费',
      prop: 'serviceCharge'
    }, {
      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}

export const tableOption2 = {
  ...commonConfig,
  column: [
    {
      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
      formatter: (row, value, label, column) => {
        return value ? value.split(' ')[0] : '-'
      },
    }, {
      label: '合计',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'count'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'money'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'serviceCharge'
      }]
    }, {
      label: 'TVM电子收入（一二五九十四号线）',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'lineGroup1_count',
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'lineGroup1_money',
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'lineGroup1_serviceCharge',
      }]
    }, {
      label: 'TVM电子收入（三四六号线）',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'lineGroup2_count',
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'lineGroup2_money',
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'lineGroup2_serviceCharge',
      }]
    }, {

      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}


export const tableOption3 = {
  ...commonConfig,
  column: [
    {

      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
      formatter: (row, value, label, column) => {
        return value ? value.split(' ')[0] : '-'
      },
    }, {
      label: '合计',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'totalCount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'totalMoney'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'totalServiceCharge'
      }]
    }, {
      label: '消费过闸',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'consumeCount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'consumeMoney'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'consumeServiceCharge'
      }]
    }, {
      label: '自发码',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'zfmCount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'zfmMoney'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'zfmServiceCharge'
      }]
    }, {

      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}
//需要改为长安通卡充资对账确认表（中铁-地铁-机场城际）对应的列 13
export const tableOption4 = {
  ...commonConfig,
  column: [
    {
      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
      formatter: (row, value, label, column) => {
        return value ? value.split(' ')[0] : '-'
      },
    }, {
      label: '充值交易',
      children: [{
        label: '西安地铁',
        children: [{
          label: '电子',
          children: [{
            type: 'input',
            showSummary: true,
            label: '笔数',
            prop: 'eleXasubwayAmount'
          }, {
            type: 'input',
            showSummary: true,
            precision: 2,
            formatter: (row, value, label, column) => {
              return rcaNumberFormat(value, true)
            },
            label: '金额',
            prop: 'eleXasubwayMoney'
          }]
        }, {
          label: '现金',
          children: [{
            type: 'input',
            showSummary: true,
            label: '笔数',
            prop: 'cashXasubwayAmount'
          }, {
            type: 'input',
            showSummary: true,
            precision: 2,
            formatter: (row, value, label, column) => {
              return rcaNumberFormat(value, true)
            },
            label: '金额',
            prop: 'cashXasubwayMoney'
          }]
        }]
      }, {
        label: '西安中铁',
        children: [{
          label: '电子',
          children: [{
            type: 'input',
            showSummary: true,
            label: '笔数',
            prop: 'eleXaztAmount'
          }, {
            type: 'input',
            showSummary: true,
            precision: 2,
            formatter: (row, value, label, column) => {
              return rcaNumberFormat(value, true)
            },
            label: '金额',
            prop: 'eleXaztMoney'
          }]
        }, {
          label: '现金',
          children: [{
            type: 'input',
            showSummary: true,
            label: '笔数',
            prop: 'cashXaztAmount'
          }, {
            type: 'input',
            showSummary: true,
            precision: 2,
            formatter: (row, value, label, column) => {
              return rcaNumberFormat(value, true)
            },
            label: '金额',
            prop: 'cashXaztMoney'
          }]
        }]
      }, {
        label: '机场城际',
        children: [{
          label: '电子',
          children: [{
            type: 'input',
            showSummary: true,
            label: '笔数',
            prop: 'eleAirAmount'
          }, {
            type: 'input',
            showSummary: true,
            precision: 2,
            formatter: (row, value, label, column) => {
              return rcaNumberFormat(value, true)
            },
            label: '金额',
            prop: 'eleAirMoney'
          }]
        }, {
          label: '现金',
          children: [{
            type: 'input',
            showSummary: true,
            label: '笔数',
            prop: 'cashAirAmount'
          }, {
            type: 'input',
            showSummary: true,
            precision: 2,
            formatter: (row, value, label, column) => {
              return rcaNumberFormat(value, true)
            },
            label: '金额',
            prop: 'cashAirMoney'
          }]
        }]
      }]
    }, {
      label: '充值小计',
      children: [{
        label: '西安地铁',
        children: [{
          type: 'input',
          showSummary: true,
          label: '笔数',
          prop: 'totalXasubwayAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '金额',
          prop: 'totalXasubwayMoney'
        }]
      }, {
        label: '西安中铁',
        children: [{

          type: 'input',
          showSummary: true,
          label: '笔数',
          prop: 'totalXaztAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '金额',
          prop: 'totalXaztMoney'
       }]
      }, {
        label: '机场城际',
        children: [{

          type: 'input',
          showSummary: true,
          label: '笔数',
          prop: 'totalAirAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '金额',
          prop: 'totalAirMoney'
       }]
      }]}, {
        label: '合计',
          children: [{
            type: 'input',
            showSummary: true,
            label: '合计笔数',
            prop: 'totalAmount'
          }, {
            type: 'input',
            showSummary: true,
            precision: 2,
            formatter: (row, value, label, column) => {
              return rcaNumberFormat(value, true)
            },
            label: '合计金额',
            prop: 'totalMoney'
          }]
      }, {
      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}
// export const tableOption4 = {
//   ...commonConfig,
//   column: [
//     {

//       type: 'input',
//       label: '唯一标识',
//       prop: 'id',
//       hide: true,
//       display: false
//     }, {
//       type: 'date',
//       label: '交易日期',
//       prop: 'tradeDate',
//       valueFormat: 'yyyy-MM-dd',
//       formatter: (row, value, label, column) => {
//         return value ? value.split(' ')[0] : '-'
//       },
//     }, {
//       label: '支付宝',
//       children: [{
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '合计',
//         prop: 'alipayTotal'
//       }, {
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '地铁',
//         prop: 'alipyaSubwayMoney'
//       }, {
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '城际',
//         prop: 'alipyaAirMoney'
//       }]
//     }, {
//       label: '微信',
//       children: [{
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '合计',
//         prop: 'wechatTotal'
//       }, {
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '地铁',
//         prop: 'wechatSubwayMoney'
//       }, {
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '城际',
//         prop: 'wechatAirMoney'
//       }]
//     }, {
//       label: '银联',
//       children: [{
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '合计',
//         prop: 'bankTotal'
//       }, {
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '地铁',
//         prop: 'bankSubwayMoney'
//       }, {
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '城际',
//         prop: 'bankAirMoney'
//       }]
//     }, {
//       label: '云闪付',
//       children: [{
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '合计',
//         prop: 'bankQuickTotal'
//       }, {
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '地铁',
//         prop: 'bankQuickSubwayMoney'
//       }, {
//         type: 'input',
//         showSummary: true,
//         precision: 2,
//         formatter: (row, value, label, column) => {
//           return rcaNumberFormat(value, true)
//         },
//         label: '城际',
//         prop: 'bankQuickAirMoney'
//       }]
//     }, {
//       type: 'input',
//       label: '数据提醒',
//       prop: 'errMsg',
//       slot: true
//     }]
// }


export const tableOption5 = {
  ...commonConfig,
  column: [
    {
      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
      formatter: (row, value, label, column) => {
        return value ? value.split(' ')[0] : '-'
      },
    }, {
      label: '充值交易',
      children: [{
        label: '西安地铁',
        children: [{
          type: 'input',
          showSummary: true,
          label: '笔数',
          prop: 'replenishXasubwayAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '金额',
          prop: 'replenishXasubwayMoney'
        }]
      }, {
        label: '机场城际',
        children: [{

          type: 'input',
          showSummary: true,
          label: '笔数',
          prop: 'replenishAirAmount'
         }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '金额',
          prop: 'replenishAirMoney'
        }]
      },{
        label: '西安中铁',
        children: [{

          type: 'input',
          showSummary: true,
          label: '笔数',
          prop: 'replenishXaztAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '金额',
          prop: 'replenishXaztMoney'
       }]
      }]
   	 /* {
      label: '售卡交易',
      children: [{
        label: '西安地铁',
        children: [{

          type: 'input',
          showSummary: true,
          label: '笔数',
          prop: 'salecardXasubwayAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '金额',
          prop: 'salecardXasubwayMoney'
        }]
      }, {
        label: '机场城际',
        children: [{
          type: 'input',
          showSummary: true,
          label: '笔数',
          prop: 'salecardAirAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '金额',
          prop: 'salecardAirMoney'
        }]
      }]*/
    }, {
      label: '合计',
      children: [{
        label: '充资交易',
        children: [{
          type: 'input',
          showSummary: true,
          label: '合计笔数',
          prop: 'totalReplenishAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '合计金额',
          prop: 'totalReplenishMoney'
        }]
      /*}, {
        label: '售卡交易',
        children: [{

          type: 'input',
          showSummary: true,
          label: '合计笔数',
          prop: 'totalSalecardAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '合计金额',
          prop: 'totalSalecardMoney'
        }]
      }, {
        label: '合计',
        children: [{
          type: 'input',
          showSummary: true,
          label: '合计笔数',
          prop: 'totalAmount'
        }, {

          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '合计金额',
          prop: 'totalMoney'
        }]*/
      }]
    }, {

      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}



export const tableOption6 = {
  ...commonConfig,
  column: [
    {

      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
      formatter: (row, value, label, column) => {
        return value ? value.split(' ')[0] : '-'
      },
    }, {
      label: '补票',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'ticketExtensionAmount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'ticketExtensionMoney'
      }]
    }, {
      label: '出站',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'outboundAmount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'outboundMoney'
      }]
    }, {
      label: '进站',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'pullinAmount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'pullinMoney'
      }]
    }, {
      label: '合计',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'totalAmount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'totalMoney'
      }]
    }, {

      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}


export const tableOption7 = {
  ...commonConfig,
  column: [
    {
      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
      formatter: (row, value, label, column) => {
        return value ? value.split(' ')[0] : '-'
      },
    }, {
      label: '系统清分',
      children: [{
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '西安地铁',
        prop: 'sysXianAmount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '机场城际',
        prop: 'sysAirprotAmount' 
	   }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '西安中铁',
        prop: 'sysXianZhongtieAmount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '合计金额',
        prop: 'sysTotal'
      }]
    }, {
      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}

export const tableOption8 = {
  ...commonConfig,
  column: [
    {
      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
      formatter: (row, value, label, column) => {
        return value ? value.split(' ')[0] : '-'
      },
    }, {
      label: '一日票',
      children: [{
        type: 'input',
        showSummary: true,
        label: '售卖数量',
        prop: 'oneticketCount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '售卖金额',
        prop: 'oneticketMoney'
      }, {
        type: 'input',
        showSummary: true,
        label: '剩余库存数量',
        prop: 'oneticketStockCount'
      }]
    }, {
      label: '三日票',
      children: [{
        type: 'input',
        showSummary: true,
        label: '售卖数量',
        prop: 'thirdticketCount'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '售卖金额',
        prop: 'thirdticketMoney'
      }, {
        type: 'input',
        showSummary: true,
        label: '剩余库存数量',
        prop: 'thirdticketStockCount'
      }]
    }, {
      label: '合计',
        children: [{
          type: 'input',
          showSummary: true,
          label: '售卖数量',
          prop: 'totalCount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '售卖金额',
          prop: 'totalMoney'
        }, {
          type: 'input',
          showSummary: true,
          label: '剩余库存数量',
          prop: 'totalStockCount'
        }]
    }, {
      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}

export const tableOption9 = {
  ...commonConfig,
  column: [
    {

      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
      formatter: (row, value, label, column) => {
        return value ? value.split(' ')[0] : '-'
      },
    }, {
      label: '合计',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'count'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'money'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'serviceCharge'
      }]
    }, {
      label: '地铁账户',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'countSubway'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'moneySubway'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'serviceChargeSubway'
      }]
    }, {
      label: '智码账户',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'countZhima'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'moneyZhima'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'serviceChargeZhima'
      }]
    }, {

      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}
//POS机对账确认表
export const tableOption10 = {
  ...commonConfig,
  column: [
    {

      type: 'input',
      label: '唯一标识',
      prop: 'id',
      hide: true,
      display: false
    }, {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate',
      valueFormat: 'yyyy-MM-dd',
      formatter: (row, value, label, column) => {
        return value ? value.split(' ')[0] : '-'
      },
    }, {
      label: '合计',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'count'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'money'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'serviceCharge'
      }]
    }, {
      label: '外卡',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'countOutcard'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'moneyOutcard'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'serviceChargeOutcard'
      }]
    }, {
      label: '银行借记卡',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'countBorrowcard'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'moneyBorrowcard'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'serviceChargeBorrowcard'
      }]
    }, {
      label: '银行贷记卡',
      children: [{
        type: 'input',
        showSummary: true,
        label: '笔数',
        prop: 'countLoancard'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '金额',
        prop: 'moneyLoancard'
      }, {
        type: 'input',
        showSummary: true,
        precision: 2,
        formatter: (row, value, label, column) => {
          return rcaNumberFormat(value, true)
        },
        label: '手续费',
        prop: 'serviceChargeLoancard'
      }]
    }, {

      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}
function uniqueArray (arr) {
  return Array.from(new Set(arr))
}
function sum (arr) {
  var s = 0;
  for (var i = arr.length - 1; i >= 0; i--) {
    s += arr[i];
  }
  return s;
}

export const tableOption2DataFormat = (data) => {
  const dateArr = uniqueArray(data.map(d => d.tradeDate))
  const lineGroup1 = data.filter(d => d.lineGroup === '1')
  const lineGroup2 = data.filter(d => d.lineGroup === '2')
  const lineGroup3 = data.filter(d => d.lineGroup === '3')
  const lineGroupSum = dateArr.map(date => {
    const temp = data.filter(d => d.tradeDate === date)
    const countArr = temp.map(d => d.count)
    const moneyArr = temp.map(d => d.money)
    const serviceChargeArr = temp.map(d => d.serviceCharge)

    const lineGroup1Data = lineGroup1.find(data => data.tradeDate === date) || {}
    const lineGroup2Data = lineGroup2.find(data => data.tradeDate === date) || {}
    const lineGroup3Data = lineGroup3.find(data => data.tradeDate === date) || {}
    return {
      id: date,
      tradeDate: date,
      count: sum(countArr),
      money: sum(moneyArr),
      serviceCharge: sum(serviceChargeArr),
      lineGroup1_count: lineGroup1Data.count,
      lineGroup1_money: lineGroup1Data.money,
      lineGroup1_serviceCharge: lineGroup1Data.serviceCharge,
      lineGroup2_count: lineGroup2Data.count,
      lineGroup2_money: lineGroup2Data.money,
      lineGroup2_serviceCharge: lineGroup2Data.serviceCharge,
      lineGroup3_count: lineGroup3Data.count,
      lineGroup3_money: lineGroup3Data.money,
      lineGroup3_serviceCharge: lineGroup3Data.serviceCharge,
      errMsg: uniqueArray(temp.filter(t => t.errMsg).map(t => t.errMsg)).join(',')
    }
  })
  return lineGroupSum
}

export const confirmTableConfigMap = {
  '1': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '2': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '3': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '4': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '5': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '8': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '9': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '10': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '12': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '19': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '6': {
    option: tableOption2,
    dataFormat: (data) => tableOption2DataFormat(data)
  },
  '7': {
    option: tableOption2,
    dataFormat: (data) => tableOption2DataFormat(data)
  },
  '11': {
    option: tableOption3,
    dataFormat: (data) => data
  },
  '13': {
    option: tableOption4,
    dataFormat: (data) => data
  },
  '14': {
    option: tableOption5,
    dataFormat: (data) => data
  },
  '15': {
    option: tableOption6,
    dataFormat: (data) => data
  },
  '16': {
    option: tableOption6,
    dataFormat: (data) => data
  },
  '17': {
    option: tableOption7,
    dataFormat: (data) => data
  },
  '18': {
    option: tableOption7,
    dataFormat: (data) => data
  },
  '20': {
    option: tableOption8,
    dataFormat: (data) => data
  },
 '21': {
    option: tableOption1,
    dataFormat: (data) => data
  },
 '22': {
    option: tableOption1,
    dataFormat: (data) => data
  },
 '23': {
    option: tableOption9,
    dataFormat: (data) => data
  },
 '24': {
    option: tableOption10,
    dataFormat: (data) => data
  }
}
